﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.HomeServer.Controls;
using System.Windows.Forms;

namespace Umbrella.Whs.WhsAddin.Controls
{
    public class WizardPageHost<T_Panel> : WizardPage where T_Panel : WizardPageClientBase, new()
    {
        private WizardPageClientBase _child;

        public override void StartRealWork()
        {
            base.StartRealWork();

            // forward to child
            if (_child != null)
                _child.StartRealWork();
        }

        public WizardPageHost(Wizard parentWizard, object currentSubject, object currentParameter1)
        {
            if (parentWizard == null)
                throw new ArgumentNullException("parentWizard");

            this.ParentWizard = parentWizard;

            // create child
            _child = new T_Panel();

            // setup wizard
            this.TitleText = _child.TitleText ?? string.Empty;

            this.HideTopBannerAndLines = false; // !(_child is WizardPageClientBannerTop);
            this.HideLeftBanner = true; // !(_child is WizardPageClientBannerLeft);

            this.ContentsControl = _child;

            _child.SetWizardPage(this, true);

            Init();

            _child.ParentWizard = parentWizard;

            _child.SetWizardPage(this, false);
        }

    }
}